pieGraphDialog <- function(){
	Library("colorspace")
	initializeDialog(title=gettextRcmdr("Pie Chart"))
	variableBox <- variableListBox(top, title=gettextRcmdr("Variable (pick one)"))
	onOK <- function(){
		variable <- getSelection(variableBox)
		closeDialog()
		if (length(variable) == 0){
			errorCondition(recall=pieChart, message=gettextRcmdr("You must select a variable"))
			return()
		}
		.activeDataSet <- ActiveDataSet()
		command <- (paste("pie(table(", .activeDataSet, "$", variable, "), labels=names(table(",
							.activeDataSet, "$", variable, ')), main="', variable, '", col=rainbow_hcl(nrow(table(',
							.activeDataSet, "$", variable, "))))", sep=""))
		logger(command)
		justDoIt(command)
		activateMenus()
		tkfocus(CommanderWindow())
	}
	OKCancelHelp(helpSubject="pie")
	tkgrid(getFrame(variableBox), sticky="nw")
	tkgrid(buttonsFrame, sticky="w")
	dialogSuffix(rows=3, columns=1)
}

